﻿/*####################################################################
 # Class used to draw a certain shape                                #
 #####################################################################*/

var SHAPES = {
    CUSTOM: 0,
    SPHERE: 1
};

var Shape = (function (Context) {
    var shapeWidth;
    var shapeHeight;
    var xPos;
    var yPos;
    var zPos;
    var shapeType;
    var core;
    var loader;
    var threedObj;

    function Shape(inshapeType, obj, mtl) {
        this.shapeType = inshapeType;
        this.threedObj = new ThreedObject(obj, mtl);
    }

    Shape.prototype.drawShape = function (inWidth, inHeight, inXPos, inYPos, inZPos) {
        this.shapeWidth = inWidth;
        this.shapeHeight = inHeight;
        this.xPos = inXPos;
        this.yPos = inYPos;
        this.zPos = inZPos;

        if (this.shapeType === SHAPES.SPHERE) {
            var sphereGeometry = new THREE.SphereGeometry(100, 50, 50);
            var sphereMaterial = new THREE.MeshPhongMaterial({ color: 0xff0000, transparent: true, opacity: 1 });
            this.core = new THREE.Mesh(sphereGeometry, sphereMaterial);
            this.core.position.set(inXPos, inYPos, inZPos);
        }
        else if (this.shapeType === SHAPES.CUSTOM) {
           
            //loadOBJMT(this.core, this.xPos, this.yPos);
            loadOBJMT(this);
        }
     
    }

    //Shape.prototype.update = function () {
    //    alert('in the update');
    //}

    return Shape;
})();
